package cn.wolfcode.wolf2world.elasitcsearch.query;

import cn.wolfcode.wolf2world.query.QueryObject;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;

/**
 * @author 杨兴健
 * @Date 2020/8/20 19:31
 */
@Getter
@Setter
public class SearchQueryObject extends QueryObject {

    public static final int TYPE_ALL = -1;  //所有
    public static final int TYPE_DEST = 0;  //目的地
    public static final int TYPE_STRATEGY = 1;  //攻略
    public static final int TYPE_TRAVEL = 2;  //游记
    public static final int TYPE_USER = 3;  //用户

    private Integer type;
    private String keyword;
    private Pageable pageable;

    public Pageable getPageable() {
        if (pageable == null) {
           return PageRequest.of(0,5, Sort.Direction.ASC,"_id");
        }
        return pageable;
    }

}
